Skip to content

Add LSPS1 server side support - #1053

Open
Anyitechs wants to merge 3 commits into
lightningdevkit:mainfrom
Anyitechs:2026-07-lsps1-service-integration
Open

Anyitechs wants to merge 3 commits into
lightningdevkit:mainfrom
Anyitechs:2026-07-lsps1-service-integration

Conversation

@Anyitechs

@Anyitechs Anyitechs commented Aug 17, 2026 •

Copy link
Copy Markdown

This PR adds LSPS1 server side support to LDK Node, enabling a node to act as an LSPS1 service.

Details

The service exposes an LSPS1Service object that holds the LSPS1 supported_options and a local service_config object allowing the LSP to configure their fee details, signal BOLT11, BOLT12 and/or onchain payments support etc.

Client requests arriving via LSPS1ServiceEvent::RequestForPaymentDetails are kept in the store after validations per the spec requirements, and the LSP supported payment details sent back to the client via LSPS1ServiceHandler::send_payment_details.

Payments

BOLT11/BOLT12: When an LdkEvent::PaymentClaimable event arrives, we intercept early to check if the payment was an LSPS1 order payment, and goes ahead to claim it via ChannelManager::claim_funds if we find a matching payment_hash or offer_id in the store. Afterward, we open the channel and remove the order from the store.

Onchain Payments: After a wallet sync completes, we check to confirm if an LSPS1 payment did land in our onchain wallet, then opens the channel if we can find the payment via Wallet::list_confirmed_utxos().

Each payment option has an expiration window. Invoices has an expiration time, so we expect the client node to refuse paying an expired invoice. But Onchain payments are different, so if a client sends to the LSP's address after the expiration window, we trigger a refund back to the client's refund_onchain_address the total amount received minus the network fees.

There's a 24 hour window to remove orders from the store to avoid bloating. This is majorly for unpaid orders as paid orders are processed as soon as the payment arrives and removed from the store. But because there's no way to stop an LSP address from receiving payments when the order has been created and payment details sent out to the client. Such payments arriving when the order has been removed are forfeited.

Tests

Integration tests for the three payment options happy path are added.

Closes #917

@ldk-reviews-bot

ldk-reviews-bot commented Aug 17, 2026 •

Copy link
Copy Markdown

I've assigned @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@Anyitechs
Anyitechs force-pushed the 2026-07-lsps1-service-integration branch 3 times, most recently from 1b93d7b to 0a20f85 Compare August 26, 2026 03:12
@Anyitechs
Anyitechs force-pushed the 2026-07-lsps1-service-integration branch from 0a20f85 to f159826 Compare September 14, 2026 18:22
@Anyitechs
Anyitechs force-pushed the 2026-07-lsps1-service-integration branch 5 times, most recently from 29ac964 to ffa9b3a Compare October 13, 2026 23:48
@Anyitechs
Anyitechs force-pushed the 2026-07-lsps1-service-integration branch from ffa9b3a to 94fe523 Compare October 21, 2026 15:34
@Anyitechs
Anyitechs marked this pull request as ready for review October 31, 2026 08:53
@ldk-reviews-bot
ldk-reviews-bot requested a review from tnull October 31, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LSPS1 service integration tracking issue

2 participants